package cate.game.admin.menu.mall;

import cate.common.table.d.GDMall;
import cate.game.GameBody;
import cate.game.admin.menu.MenuSetup;
import cate.game.role.mall.Mall;
import easy.java.practice.errorcode.EcResult;

public class MallMenu extends MenuSetup {
    public MallMenu(GameBody gameBody) {
        super("商城");

        reg(gameBody,
                "刷新某个商城",
                1,
                "【参数1】商城ID",
                (role, params) -> {
                    EcResult<Mall> r = role.getMall().refreshMall(Integer.parseInt(params.get(0)), 1);
                    if(!r.ok()){
                        gameBody.notice.message(role, r.message);
                    }
                });

        reg(gameBody,
                "金币商城设置下次刷新时间",
                1,
                "【参数1】下次刷新时间",
                (role, params) -> {
                    GDMall.GoldenMall.GOLD_MALL_CYCLE = params.get(0);
                    role.getRes().goldMall.checkRefresh();
                    role.getRes().goldMall.noticeUpdate();
                });

    }
}
